package avicit.bdp.dms.tdm.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.properties.PlatformConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/**
 * @金航数码科技有限责任公司
 * @作者：${tableInfo.classCreator}
 * @邮箱：${tableInfo.classMailbox}
 * @创建时间： 2023-11-14 16:03
 * @类说明：bdp_asset_apply
 * @修改记录：
 */
@ApiModel(value = "AssetApplyDTO", description = "数据资产申请表")
@Table(name = "bdp_asset_apply")
public class AssetApplyDTO extends BaseDTO {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id
    @LogField
    @ApiModelProperty(value = "主键", name = "id")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 数据资产id
     */
    @LogField
    @ApiModelProperty(value = "数据资产id", name = "assetId")
    @FieldRemark(column = "asset_id", field = "assetId", name = "数据资产id")
    private String assetId;

    /**
     * 资产标题
     */
    @LogField
    @ApiModelProperty(value = "资产标题", name = "assetTitle")
    @FieldRemark(column = "asset_title", field = "assetTitle", name = "资产标题")
    private String assetTitle;

    /**
     * 申请标题
     */
    @LogField
    @ApiModelProperty(value = "申请标题", name = "applyTitle")
    @FieldRemark(column = "apply_title", field = "applyTitle", name = "申请标题")
    private String applyTitle;

    /**
     * 申请用户
     */
    @LogField
    @ApiModelProperty(value = "申请用户", name = "applyPerson")
    @FieldRemark(column = "apply_person", field = "applyPerson", name = "申请用户")
    private String applyPerson;

    /**
     * 申请时间
     */
    @LogField
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "申请时间", name = "applyTime")
    @FieldRemark(column = "apply_time", field = "applyTime", name = "申请时间")
    private Date applyTime;

    /**
     * 资源类型[1-数据服务/2-文档/3-报表分析/4-模型]
     */
    @LogField
    @ApiModelProperty(value = "资源类型[1-数据服务/2-文档/3-报表分析/4-模型]", name = "resourceType")
    @FieldRemark(column = "resource_type", field = "resourceType", name = "资源类型")
    private Integer resourceType;

    /**
     * 审核状态，1-待审批，2-审批通过，3-审批不通过，4-已撤回
     */
    @LogField
    @ApiModelProperty(value = "审核状态，1-待审批，2-审批通过，3-审批不通过，4-已撤回", name = "checkerStatus")
    @FieldRemark(column = "checker_status", field = "checkerStatus", name = "审核状态")
    private Integer checkerStatus;

    /**
     * 编辑状态
     */
    @LogField
    @ApiModelProperty(value = "编辑状态", name = "editStatus")
    @FieldRemark(column = "edit_status", field = "editStatus", name = "编辑状态")
    private String editStatus;

    /**
     * 扩展属性
     */
    @LogField
    @ApiModelProperty(value = "扩展属性", name = "extAttr")
    @FieldRemark(column = "ext_attr", field = "extAttr", name = "扩展属性")
    private String extAttr;

    /**
     * 状态
     */
    @LogField
    @ApiModelProperty(value = "状态", name = "status")
    @FieldRemark(column = "status", field = "status", name = "状态")
    private String status;

    /**
     * 描述
     */
    @LogField
    @ApiModelProperty(value = "描述", name = "remark")
    @FieldRemark(column = "remark", field = "remark", name = "描述")
    private String remark;

    /**
     * 数据权属
     */
    @LogField
    @ApiModelProperty(value = "数据权属", name = "dataPerm")
    @FieldRemark(column = "data_perm", field = "dataPerm", name = "数据权属")
    private String dataPerm;

    /**
     * 数据来源
     */
    @LogField
    @ApiModelProperty(value = "数据来源", name = "dataOrigin")
    @FieldRemark(column = "data_origin", field = "dataOrigin", name = "数据来源")
    private String dataOrigin;

    /**
     * 申请服务类型[1-数据查询/2-数据推送/3-API接口/4-下载/5-模型/6-报表]，逗号分隔
     */
    @LogField
    @ApiModelProperty(value = "申请服务类型[1-数据查询/2-数据推送/3-API接口/4-下载/5-模型/6-报表]，逗号分隔", name = "applyServiceType")
    @FieldRemark(column = "apply_service_type", field = "applyServiceType", name = "申请服务类型")
    private String applyServiceType;

    /**
     * 应用ID
     */
    @LogField
    @ApiModelProperty(value = "应用ID", name = "applicationId")
    @FieldRemark(column = "application_id", field = "applicationId", name = "应用ID")
    private String applicationId;

    /**
     * 推送格式，1-数据库，2-WebService，3-REST
     */
    @LogField
    @ApiModelProperty(value = "推送格式，1-数据库，2-WebService，3-REST", name = "pushFormat")
    @FieldRemark(column = "push_format", field = "pushFormat", name = "推送格式")
    private Integer pushFormat;

    /**
     * 推送方式，1-全量，2-增量
     */
    @LogField
    @ApiModelProperty(value = "推送方式，1-全量，2-增量", name = "pushMode")
    @FieldRemark(column = "push_mode", field = "pushMode", name = "推送方式")
    private Integer pushMode;

    /**
     * 扩展参数json数据
     */
    @ApiModelProperty(value = "扩展参数json数据", name = "extendParam")
    @FieldRemark(column = "extend_param", field = "extendParam", name = "扩展参数json数据")
    private String extendParam;

    /**
     * 配置定时任务，是：1，否：0
     */
    @ApiModelProperty(value = "配置定时任务，是：1，否：0", name = "configCrontab")
    @FieldRemark(column = "config_crontab", field = "configCrontab", name = "配置定时任务")
    private Integer configCrontab;

    /**
     * 启用定时任务，是：1，否：0
     */
    @ApiModelProperty(value = "启用定时任务，是：1，否：0", name = "enableCrontab")
    @FieldRemark(column = "enable_crontab", field = "enableCrontab", name = "启用定时任务")
    private Integer enableCrontab;

    @Transient
    private String checkerStatusName;
    @Transient
    private String applyPersonName;
    @Transient
    private String applicationName;
    /**
     * 申请单位
     */
    @Transient
    private String applyUnit;

    public String getApplyUnit() {
        return applyUnit;
    }

    public void setApplyUnit(String applyUnit) {
        this.applyUnit = applyUnit;
    }

    public String getApplyPersonName() {
        return applyPersonName;
    }

    public void setApplyPersonName(String applyPersonName) {
        this.applyPersonName = applyPersonName;
    }

    public String getCheckerStatusName() {
        return checkerStatusName;
    }

    public void setCheckerStatusName(String checkerStatusName) {
        this.checkerStatusName = checkerStatusName;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getAssetId() {
        return assetId;
    }

    public void setAssetId(String assetId) {
        this.assetId = assetId;
    }

    public String getAssetTitle() {
        return assetTitle;
    }

    public void setAssetTitle(String assetTitle) {
        this.assetTitle = assetTitle;
    }

    public String getApplyTitle() {
        return applyTitle;
    }

    public void setApplyTitle(String applyTitle) {
        this.applyTitle = applyTitle;
    }

    public String getApplyPerson() {
        return applyPerson;
    }

    public void setApplyPerson(String applyPerson) {
        this.applyPerson = applyPerson;
    }

    public Date getApplyTime() {
        return applyTime;
    }

    public void setApplyTime(Date applyTime) {
        this.applyTime = applyTime;
    }

    public Integer getResourceType() {
        return resourceType;
    }

    public void setResourceType(Integer resourceType) {
        this.resourceType = resourceType;
    }

    public Integer getCheckerStatus() {
        return checkerStatus;
    }

    public void setCheckerStatus(Integer checkerStatus) {
        this.checkerStatus = checkerStatus;
    }

    public String getEditStatus() {
        return editStatus;
    }

    public void setEditStatus(String editStatus) {
        this.editStatus = editStatus;
    }

    public String getExtAttr() {
        return extAttr;
    }

    public void setExtAttr(String extAttr) {
        this.extAttr = extAttr;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getDataPerm() {
        return dataPerm;
    }

    public void setDataPerm(String dataPerm) {
        this.dataPerm = dataPerm;
    }

    public String getDataOrigin() {
        return dataOrigin;
    }

    public void setDataOrigin(String dataOrigin) {
        this.dataOrigin = dataOrigin;
    }

    public String getApplyServiceType() {
        return applyServiceType;
    }

    public void setApplyServiceType(String applyServiceType) {
        this.applyServiceType = applyServiceType;
    }

    public String getApplicationId() {
        return applicationId;
    }

    public void setApplicationId(String applicationId) {
        this.applicationId = applicationId;
    }

    public Integer getPushFormat() {
        return pushFormat;
    }

    public void setPushFormat(Integer pushFormat) {
        this.pushFormat = pushFormat;
    }

    public Integer getPushMode() {
        return pushMode;
    }

    public void setPushMode(Integer pushMode) {
        this.pushMode = pushMode;
    }

    public String getExtendParam() {
        return extendParam;
    }

    public void setExtendParam(String extendParam) {
        this.extendParam = extendParam;
    }

    public Integer getConfigCrontab() {
        return configCrontab;
    }

    public void setConfigCrontab(Integer configCrontab) {
        this.configCrontab = configCrontab;
    }

    public Integer getEnableCrontab() {
        return enableCrontab;
    }

    public void setEnableCrontab(Integer enableCrontab) {
        this.enableCrontab = enableCrontab;
    }

    public String getApplicationName() {
        return applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "资产申请模块";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "资产申请";
        } else {
            return super.logTitle;
        }
    }

    public PlatformConstant.LogType getLogType() {
        if (super.logType == null) {
            return PlatformConstant.LogType.module_operate;
        } else {
            return super.logType;
        }
    }

}